﻿using shop.Model;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace shop.cost
{
    public partial class AdjustPriceForm : Form
    {

        public GoodsPrice Data { get; set; }    

        public AdjustPriceForm()
        {
            InitializeComponent();
            this.box_begin.Value = DateTime.Today;
        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            Data.Price= box_price.Value;
            Data.BeginDate = box_begin.Value;
            Data.EndDate = new DateTime(2099, 1, 1);
            this.DialogResult = DialogResult.OK;
            this.Close  ();
        }

        private void AdjustPriceForm_Load(object sender, EventArgs e)
        {
            if (Data != null)
            {
                this.box_begin.Value = Data.BeginDate ?? DateTime.Today;
                this.box_price.Value = Data.Price;
            }
        }



    }
}
